<style>
    .active{
        display: none;
    }
</style>
<div class="layuimini-container">
    <form id="app-form" class="layui-form layuimini-form">
        <div class="layui-form-item">
            <label class="layui-form-label">产品标题</label>
            <div class="layui-input-block">
                <input type="text"  class="layui-input" readonly  value="{$row.title}">
            </div>
        </div>
        <div class="layui-form-item">
            <label class="layui-form-label">申请人</label>
            <div class="layui-input-block">
                <input type="text" name="realname" readonly  class="layui-input" value="{$row.realname}">
            </div>
        </div>
        <div class="layui-form-item">
            <label class="layui-form-label">联系电话</label>
            <div class="layui-input-block">
                <input type="text" name="mobile" readonly  class="layui-input" value="{$row.mobile}">
            </div>
        </div>
        <div class="hr-line"></div>
        <div class="layui-form-item">
            <label class="layui-form-label">审核状态</label>
            <div class="layui-input-block">
                {if condition="$row['status'] eq 0"}
                <select name="status"  id="orderstatus" class="layui-text" lay-filter="filter" lay-verify="required">
                    <option value="">请选择</option>
                    <option value="1">审核通过</option>
                    <option value="2">审核拒绝</option>
                </select>
                {else /}
                <select name="status"  class="layui-text" lay-verify="required">
                    <option value="1" disabled {if condition="$row['status'] eq 1"}selected{/if}>审核通过</option>
                    <option value="2" disabled {if condition="$row['status'] eq 2"}selected{/if}>审核拒绝</option>
                </select>
                {/if}
                <tip>选择审核通过：需填写完整的 （贷款额度、还款周期、利率、还款计划以及发放佣金）;</tip>
            </div>
        </div>
        {if condition="$row['status'] lt 2"}
        <div class="formtable">
            <div class="layui-form-item">
                <label class="layui-form-label required">贷款额度</label>
                <div class="layui-input-block" style="display: flex;">
                    <input type="text" name="orderprice"  class="layui-input"  value="{$row.orderprice|default=''}">
                    <div class="layuimini-upload-btn">
                        <span><a class="layui-btn">元</a></span>
                    </div>
                </div>
            </div>
            <div class="layui-form-item">
                <label class="layui-form-label required">还款周期</label>
                <div class="layui-input-block" style="display: flex;">
                    <input type="text" name="cycle" class="layui-input"  value="{$row.cycle|default=''}">
                    <div class="layuimini-upload-btn">
                        <span><a class="layui-btn">月</a></span>
                    </div>
                </div>
            </div>
            <div class="layui-form-item">
                <label class="layui-form-label required">利率</label>
                <div class="layui-input-block" style="display: flex;">
                    <input type="text" name="rate"  class="layui-input"  value="{$row.rate|default=''}">
                    <div class="layuimini-upload-btn">
                        <span><a class="layui-btn">%</a></span>
                    </div>
                </div>
            </div>
            <div class="layui-form-item">
                <label class="layui-form-label required">佣金</label>
                <div class="layui-input-block" style="display: flex;">
                    <input type="text" name="commission"  class="layui-input"  value="{$row.commission|default=''}">
                    <div class="layuimini-upload-btn">
                        <span><a class="layui-btn">元</a></span>
                    </div>
                </div>
            </div>
            <div class="layui-form-item">
                <label class="layui-form-label required">&nbsp;</label>
                <div class="layui-input-block">
                    <tip>关联渠道商才会获得发放佣金。</tip>
                </div>
            </div>
            <div class="layui-form-item">
                <label class="layui-form-label required">还款计划</label>
                <div class="layui-input-block">
                    <script type="text/plain" id="container" name="repayment">{$row.repayment|raw}</script>
                </div>
            </div>
        </div>
        {/if}

        <div class="refusetable active">
            <div class="layui-form-item">
                <label class="layui-form-label">拒绝理由</label>
                <div class="layui-input-block">
                    <script type="text/plain" id="container2" name="reason">{$row.reason|raw}</script>
                </div>
            </div>
        </div>
        <div class="hr-line"></div>
        {if condition="$row['status'] eq 0"}
        <div class="layui-form-item text-center">
            <button type="submit" class="layui-btn layui-btn-normal layui-btn-sm" lay-submit>确认</button>
            <button type="reset" class="layui-btn layui-btn-primary layui-btn-sm">重置</button>
        </div>
        {/if}
    </form>
</div>
<script src="__STATIC__/plugs/jquery-3.4.1/jquery-3.4.1.min.js"></script>
<script type="text/javascript">
    var orderstatus ='{$row.status}';
    $(document).ready(function (){
        if(orderstatus<2){
            var ue = UE.getEditor('container');
            $(".refusetable").addClass('active');
        }else{
            var ue = UE.getEditor('container2');
            $(".refusetable").removeClass('active');
        }
        layui.use('form', function() {
            var form = layui.form;
            form.on('select(filter)', function (data) {
                console.log(data.value);
                if(data.value ==2){
                    var ue = UE.getEditor('container2');
                    $(".formtable").addClass('active');
                    $(".refusetable").removeClass('active');
                }else{
                    $(".formtable").removeClass('active');
                    $(".refusetable").addClass('active');
                }

            });
        })
    })
</script>
